/**
 * Created by Administrator on 2019/10/5.
 */
var E = window.wangEditor
var editor = new E('#editor')
/* 或者 var editor = new E( document.getElementById('editor') ) */

/* 下面两个配置，使用其中一个即可显示“上传图片”的tab。但是两者不要同时使用！！！ */
editor.customConfig.uploadImgShowBase64 = true   // 使用 base64 保存图片
/* editor.customConfig.uploadImgServer = '/upload'  // 上传图片到服务器 */
// editor.config.uploadTimeout = 100000000;
editor.create()

document.getElementById('btn1').addEventListener('click', function () {
    // 读取 html
    // alert(editor.txt.html());
    var postContent = editor.txt.html();
    // alert(postContent);
    var title = document.getElementById("title").value;
    // alert(title);
    var themeId = document.getElementById("themeId").value;
    // alert(themeId);
    var classId = document.getElementById("classId").value;
    // alert(classId);
    //window.location = '/PetForums/postP/postSave?themeId='+themeId+'&classId='+classId+'&postContent='+postContent+'&title='+title
    $.post("/PetForums/postP/postSave",{
        themeId:themeId,
        classId:classId,
        postContent:postContent,
        title:title
    },function (data) {
        if (data=="未登录"){
            alert("请先登录");
        }
        if (data=="/forumF/forumFather"){
            alert("发送成功！");
        }
    })
    alert("发送成功");
}, false);

